| Einhugur Word Plugin for Xojo |
|
EinhugurWord.Drawing Class
Class representing drawings in the Word document.
Currently we only support reading drawings that are Images and or SVG.
Not Word art drawings.
Object
Drawing
class EinhugurWord.Drawing
Constructors
Drawing (private) | Private constructor. |
Properties
Examples
Embedding image from Xojo.
Note this example also needs Einhugur GraphicsFormats plugin and Einhugur TypeLib plugin.
using EinhugurWord
var ft as FileType = new FileType
ft.Extensions = "docx"
ft.Name = "Word Document"
var f as FolderItem = FolderItem.ShowSaveFileDialog(ft, "New document.docx")
if f <> nil then
try
var doc as Document = Document.Create(f)
doc.Creator = "Einhugur test user"
doc.LastModifiedBy = "Einhugur test user"
doc.Subject = "My first"
call doc.Paragraph(0).AppendRun("Hello world ! This is my first paragraph. Bellow we will add Xojo Picture")
var pic as Picture = new Picture(450,450)
var g as Graphics = pic.Graphics
g.DrawingColor = &C800000
g.FillRectangle(1,1, 200, 200)
g.DrawingColor = &C0000FF
g.FillRectangle(150,150, 200, 200)
var exporter as RawPngExporter = new RawPngExporter()
var imageData as String = exporter.SaveToString(RawBitmapConverter.FromPicture(pic))
call doc.AppendParagraph(imageData, EinhugurWord.PictureTypes.png, "My image from Xojo", pic.Width, pic.Height)
doc.Save()
catch e as WordException
MessageBox e.Message
end try
end if
Supported Platforms:
macOS Intel 64 bitmacOS Apple SiliconWindows 32 bitWindows 64 bitWindows ARM 64 bitLinux 32 bitLinux 64 bitLinux ARM 32 bitLinux ARM 64 bitiOS